﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using SubSystem.Models;
using MvcContrib;
using SubSystem.Models.ObjectStore;

namespace SubSystem.Controllers
{
    public class ControllerFactory : DefaultControllerFactory
    {
        private ObjectManager<IArticle> manager;

        public ControllerFactory(ObjectManager<IArticle> objectManager)
        {
            manager = objectManager;
        }

        protected override IController GetControllerInstance(Type controllerType)
        {
            return
                controllerType == typeof(ArticleController)  
                ? new ArticleController(manager)
                : base.GetControllerInstance(controllerType);
        }
    }
}
